import Vue from 'vue'
import VueRouter from 'vue-router'



Vue.use(VueRouter)

// 路由表
const routes = [
   {
    path: '/login',
    name: 'login',
    component: ()=> import('@/views/login')
   },
   {
    path: '/',
    name: 'layout',
    component: ()=> import('@/views/layout'),
    children: [
       {
        path: '/home', // （设了空不生效,在main.js强制让页面一进来就调到home）默认子路由只能有一个（访问layout自动来到首页）
        name: 'home',
        component: ()=> import('@/views/home'),
       },
       {
        path: '/qa',
        name: 'qa',
        component: ()=> import('@/views/qa')
       },
       {
        path: '/video',
        name: 'video',
        component: ()=> import('@/views/video')
       },
       {
        path: '/my',
        name: 'my',
        component: ()=> import('@/views/my')
       },
      ]
   },
]

const router = new VueRouter({
  routes
})

export default router
